<?php
    $url = new Url();
    $arr_region = LoadConfig::$region;
?>
<script type="text/javascript">

    var url = "<?=$url->createUrl('home/loadmiennam');?>";
    loadKetquaMienNam(url);

    $(document).ready(function(){

        $('#trangchu').addClass('active');
        $('#miennam').addClass('active');
        var d = new Date();
        var time = d.getHours(); 
        if(time == 18){
            $('#mienbac').html('<a href="<?php echo Yii::app()->createUrl('home/tuongthuatmienbac')?>">XỔ SỐ MIỀN BẮC</a>');
        }
        if(time == 16){
            $('#miennam').html('<a href="<?php echo Yii::app()->createUrl('home/tuongthuatmiennam')?>">XỔ SỐ MIỀN NAM</a>');
        }
        if(time == 17){
            $('#mientrung').html('<a href="<?php echo Yii::app()->createUrl('home/tuongthuatmientrung')?>">XỔ SỐ MIỀN TRUNG</a>');
        }

        loadChat("<?=$url->createUrl('home/chat')?>");

        setInterval(function(){
            var t = new Date().getTime();
            var url = "<?=$url->createUrl('home/loadmiennam');?>";
            loadKetquaMienNam(url);
            },3000);

        $('.From').keypress(function(e){
            if(e.keyCode == 13 && !e.shiftKey){
                $(this).trigger("enterKey");
            } 
        });

        $('textarea').bind("enterKey",function(e){
            var messenger = $('.From').val();
            var url = "<?=$url->createUrl('home/chat'); ?>";
            $.ajax({
                type: "GET",
                url: url,
                global: false,
                data: {
                    messenger: messenger,
                },
                success: function(msg){  
                    if(msg==1){
                        alert('Bạn phải đăng nhập để tán gẫu');
                    }
                    if(msg==0){
                        alert('Bạn phải chưa nhập nội dung');
                    }
                    else
                    {
                        $("#CHAT").html(msg);
                        $('.From').val('');
                    }

                }
            });
        });

    });

    function loadChat(url){
        var scroll = $('.boxCHAT').scrollTop();
        //alert(scroll);
        $.ajax({
            type: "POST",
            url: url,
            global: false,
            data:{
                
            },
            success:function(msg){
                $("#CHAT").html(msg);
            }
        });
    }

    function messenger(){
        var messenger = $('.From').val();
        var url = "<?=$url->createUrl('home/chat'); ?>";
        $.ajax({
            type: "GET",
            url: url,
            global: false,
            data: {
                messenger: messenger,
            },
            success: function(msg){
                if(msg==1){
                    alert('Bạn phải đăng nhập để tán gẫu');
                }
                if(msg==0){
                    alert('Bạn phải chưa nhập nội dung');
                }
                else
                {
                    $("#CHAT").html(msg);
                    $('.From').val('');
                }
            }
        });
    };

    function loadKetquaMienNam(url){
        $.ajax({
            type: "GET",
            url: url,
            data:{},
            success:function(msg){
                $('#KQMN').html(msg);
            }
        });
    } 

</script>

<div class="leftMain">
    <div class="menuXS">
        <ul>
            <li id="mienbac"><a href="<?php echo Yii::app()->createUrl('home/mienbac')?>">XỔ SỐ MIỀN BẮC</a></li>
            <li id="mientrung"><a href="<?php echo Yii::app()->createUrl('home/mientrung')?>">XỔ SỐ MIỀN TRUNG</a></li>
            <li id="miennam"><a href="<?php echo Yii::app()->createUrl('home/miennam')?>"><h1>XỔ SỐ MIỀN NAM</h1></a></li>
            <li id="dientoan"><a href="<?php echo Yii::app()->createUrl('home/dientoan')?>">XỔ SỐ ĐIỆN TOÁN</a></li>
        </ul>
    </div>

    <div class="XSMN" id="KQMN">
        <div class="titleXSMN">
            Tường thuật trực tiếp kết quả xổ số miền Nam
        </div>
        <div class="tableXSMN m-b-40">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#e6e6e6">
                <tr class="bg_xam">
                    <td class="giaiXSMN">
                        <p>Ngày</p>
                    </td>
                    <td class="kqXSMN">
                        <p>Tên tỉnh</p>
                    </td>
                    <td class="kqXSMN">
                        <p>Tên tỉnh</p>
                    </td>
                    <td class="kqXSMN">
                        <p>Tên tỉnh</p>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        Giải tám
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_tam_1"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_tam_2"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_tam_3"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        Giải bảy
                    </td>
                    <td class="kqXSMN bg_xam">
                        <span class="giai_bay_1"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <span class="giai_bay_2"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <span class="giai_bay_3"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        Giải sáu
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_sau_1"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        </br>
                        <span class="giai_sau_2"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        </br>
                        <span class="giai_sau_3"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_sau_4"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        </br>
                        <span class="giai_sau_5"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        </br>
                        <span class="giai_sau_6"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_sau_7"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        </br>
                        <span class="giai_sau_8"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        </br>
                        <span class="giai_sau_9"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        Giải năm
                    </td>
                    <td class="kqXSMN bg_xam">
                        <span class="giai_nam_1"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <span class="giai_nam_2"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <span class="giai_nam_3"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        Giải tư
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_tu_1"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_2"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_3"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_4"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_5"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_6"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_7"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_tu_8"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_9"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_10"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_11"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_12"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_13"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_14"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_tu_15"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_16"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_17"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_18"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_19"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_20"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_tu_21"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        Giải ba
                    </td>
                    <td class="kqXSMN bg_xam">
                        <span class="giai_ba_1"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_ba_2"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <span class="giai_ba_3"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_ba_4"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <span class="giai_ba_5"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                        <br />
                        <span class="giai_ba_6"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        Giải hai
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_nhi_1"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_nhi_2"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_nhi_3"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        Giải nhất
                    </td>
                    <td class="kqXSMN bg_xam">
                        <span class="giai_nhat_1"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <span class="giai_nhat_2"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <span class="giai_nhat_3"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        <p>Giải đặc biệt</p>
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_dacbiet_1"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_dacbiet_2"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                    <td class="kqXSMN">
                        <span class="giai_dacbiet_3"><img style="width: 20px;margin-top: 10px;margin-bottom: 10px;" src="<?php echo Yii::app()->params['static_url'];?>images/loading.gif"></span>
                    </td>
                </tr>
            </table>
        </div>

        <div class="tableXSMN">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#e6e6e6">
                <tr class="bg_xam">
                    <td class="giaiXSMN">
                        <p>Đầu</p>
                    </td>
                    <td class="kqXSMN">
                        <p>Tên tỉnh</p>
                    </td>
                    <td class="kqXSMN">
                        <p>Tên tỉnh</p>
                    </td>
                    <td class="kqXSMN">
                        <p>Tên tỉnh</p>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        <span class="red">0</span>
                    </td>
                    <td class="kqXSMN">

                    </td>
                    <td class="kqXSMN">

                    </td>
                    <td class="kqXSMN">

                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        <span class="red">1</span>
                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        <span class="red">2</span>
                    </td>
                    <td class="kqXSMN">

                    </td>
                    <td class="kqXSMN">

                    </td>
                    <td class="kqXSMN">

                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        <span class="red">3</span>
                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        <span class="red">4</span>
                    </td>
                    <td class="kqXSMN">

                    </td>
                    <td class="kqXSMN">

                    </td>
                    <td class="kqXSMN">

                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        <span class="red">5</span>
                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        <span class="red">6</span>
                    </td>
                    <td class="kqXSMN">

                    </td>
                    <td class="kqXSMN">

                    </td>
                    <td class="kqXSMN">

                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        <span class="red">7</span>
                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        <span class="red">8</span>
                    </td>
                    <td class="kqXSMN">

                    </td>
                    <td class="kqXSMN">

                    </td>
                    <td class="kqXSMN">

                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        <span class="red">9</span>
                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                    <td class="kqXSMN bg_xam">

                    </td>
                </tr>
            </table>
        </div>

        <div class="sms_LOTO">
            <?php echo Yii::app()->params['static_sms'];?>
        </div>
    </div>
    <div class="MXH">
        <div id="fb-root" style="float: right;"></div>
        <script>(function(d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=670383849682676&version=v2.0";
            fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));
        </script>
        <div class="fb-like" data-href="http://10h.vn/" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div>
    </div>
    <div class="CHAT">
            
        <div class="titleCHAT">
            Tán Gẫu
        </div>
        
        <div class="CHATarea">
            <textarea name="CHAT" placeholder="Nhập nội dung chat" cols="50" rows="1" class="From"></textarea>
        </div>
        <div style="padding:15px 20px 20px 0; text-align:right;">
            <a href="javascript:void(0);" id="emotion"><img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-yahoo.png" width="22" height="22" style="padding-right:10px;"></a>
            <a href="javascript:void(0);" onclick="loadChat('<?=$url->createUrl('home/chat')?>');"><img src="<?php echo Yii::app()->params['static_url'];?>images/Refresh.png" width="22" height="22" style="padding-right:10px;" /></a>
            <input type="button" onclick="messenger();" class="button_KQ" value="Gửi">
        </div>

        <div class="boxCHAT" id="CHAT"></div>
        
        <?php $this->renderPartial('boxemotion');?>
        
    </div>
</div>
<div class="rightMain">

    <div class="Box" id="boxketqua">
        <?php
            $this->renderPartial('boxketqua');
        ?>
    </div>

    <div class="Box" id="boxtienich">
        <?php $this->renderPartial('boxtienich');?>
    </div>

    <div class="Box" id="boxthongke">
        <?php $this->renderPartial('boxthongke');?>
    </div>

        </div>
        <div class="both"></div>
